<?php
/**
 * Created by JetBrains PhpStorm.
 * User: CAIXUDONG
 * Date: 11-6-16
 * Time: 下午4:06
 */
 
include '../bootstrap.php';

$_user = Model::getInstance('user');
$user_info = $_user->needLogin();

$zh_name = $_input->post('zh_name');
$en_name = $_input->post('en_name');
$icon_css = $_input->post('icon_css');

if(!$zh_name || !$en_name || !$icon_css){
    $data = array(
        "statusCode"=>"300",
        "message"=>"请填写来源中文名，英文名，样式！",
    );
    echo Response::JSON($data);
    exit;
}
$is_show = $_input->post('is_show',0);

$ret = Model::getInstance('baobeisource')->addBaoBeiSource($zh_name,$en_name,$is_show,$icon_css);
if($ret){

    $data = array(
        "statusCode"=>"200",
        "message"=>"添加成功",
        "navTabId"=>"baobeisource",
    );
    echo Response::JSON($data);
}else{

    $data = array(
        "statusCode"=>"300",
        "message"=>"添加失败",
    );
    echo Response::JSON($data);
}